/*
 * @Author: lwHao
 * @Date: 2020-09-18 16:18:54
 * @LastEditors: lwHao
 * @LastEditTime: 2020-09-20 15:19:56
 */
import {request} from '@/plugins/request'

// 获取公共文章列表
export const getArticles = params => {
  return request({
    method: "GET",
    url: '/api/articles',
    params
  })
}

// 获取文章标签列表
export const getTags = params => {
  return request({
    method: 'GET',
    url: '/api/tags'
  })
}

export const getFeedArticle = params => {
  return request({
    method: 'GET',
    url: '/api/articles/feed',
    params
  })
}

export const addFavorite = slug => {
  return request({
    method: 'POST',
    url: `/api/articles/${slug}/favorite`
  })
}

export const deleteFavorite = slug => {
  return request({
    method: 'DELETE',
    url: `/api/articles/${slug}/favorite`
  })
}

export const getArticle = slug => {
  return request({
    method: 'GET',
    url: `/api/articles/${slug}`
  })
}